package TeatCase;

import android.graphics.Point;
import android.provider.Contacts;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObject2;
import android.util.Log;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static HomeElements.Action.*;
import static HomeElements.AssertElementsContent.*;

import HomeElements.AssertElementsContent;
import QunarTest.QuanrTestCase;
import util.UIHelper;

import static org.junit.Assert.*;

/**
 * Created by zhe.xiao on 2017/6/26.
 */


public class TestNinKe extends QuanrTestCase{
    String s = "[(0-9\\.)]{1,10}";
    Pattern pattren = Pattern.compile(s);
    @Override
    public void setUp(){
        super.setUp();
        UIHelper.getHomeElements().getGuessYouGo().init();
    }

    /**
     * 测试第一个标签的全部跳转
     */
    @Test
    public void testTag1More(){
        UIHelper.getElementsAction().click(UIHelper.getHomeElements().getGuessYouGo().getTagElement(0));
        String td = UIHelper.getHomeElements().getGuessYouGo().getCity(0);
        UIHelper.getElementsAction().click(UIHelper.getHomeElements().getGuessYouGo().getMore());

        Log.v("UIAUTOMATOR", "testTag1More: " + td);
        String td1 = ninKeTag1TiaoDes();
        Log.v("UIAUTOMATOR", "testTag1TiaoMore: " + td1);
        assertEquals(td, td1);
    }

    /**
     * 测试第二个标签的全部跳转
     */
    @Test
    public void testTag2More(){
        UIHelper.getElementsAction().click(UIHelper.getHomeElements().getGuessYouGo().getTagElement(1));
        String td = UIHelper.getHomeElements().getGuessYouGo().getCity(1);
        UIHelper.getElementsAction().click(UIHelper.getHomeElements().getGuessYouGo().getMore());

        Log.v("UIAUTOMATOR", "testTag2More: " + td);
        String td1 = ninKeTag2TiaoDes();
        Log.v("UIAUTOMATOR", "testTag2TiaoMore: " + td1);
        assertEquals(td, td1);
    }

    /**
     * 测试第三个标签的全部跳转
     */
    @Test
    public void testTag3More(){
        UIHelper.getElementsAction().click(UIHelper.getHomeElements().getGuessYouGo().getTagElement(2));
        String td = UIHelper.getHomeElements().getGuessYouGo().getCity(2);
        UIHelper.getElementsAction().click(UIHelper.getHomeElements().getGuessYouGo().getMore());

        Log.v("UIAUTOMATOR", "testTag3More: " + td);
        String td1 = ninKeTag3TiaoDes();
        Log.v("UIAUTOMATOR", "testTag3TiaoMore: " + td1);
        assertEquals(td, td1);
    }

    /**
     * 测试您可能想去tag的数量
     */
    @Test
    public void testNinKeNengTagNum(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(0).click();
        int n = UIHelper.getHomeElements().getGuessYouGo().getTagNum();
        Log.v("UIAUTOMATOR", "testNinKeNengTagNum: " + n);
        assertEquals(n, 3);
    }

    /**
     * 测试第一个tag的第一个单品
     */
    @Test
    public void testTag1Detail1(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(0).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg1Ele();
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg1Detail(u2);
        Matcher m = pattren.matcher(list.get(2));
        Matcher m1 = pattren.matcher(list.get(3));
        float subTitle = 0.0f;
        float price = 0.0f;
        if(m.find()){
            subTitle = Float.parseFloat(m.group());
        }
        if(m1.find()){
            price = Float.parseFloat(m1.group());
        }
        Assert.assertFalse(list.get(0).isEmpty());
        Assert.assertFalse(list.get(1).isEmpty());
        Assert.assertFalse(list.get(2).isEmpty());
        Assert.assertFalse(list.get(3).isEmpty());
        Assert.assertTrue(subTitle != 0.0);
        Assert.assertTrue(price != 0.0);
        u2.click();
        Log.i("UIAUTOMATOR", "testTag1Detail1_ticket: " + list);
        if(list.get(0).indexOf("景点") != -1) {
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag1Detail1_TICKET " + t);
            Assert.assertEquals(list.get(0).split("\\|")[0], t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag1Detail1_TICKETnum " + n);
            Assert.assertTrue(n != 0);
        }
        if(list.get(0).indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag1Detail1_HOTLE " + t);
            Assert.assertEquals(list.get(0).split("\\|")[0], t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag1Detail1_HotelTnum " + n);
            Assert.assertTrue(n != 0);
        }
        if(list.get(0).indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
    }

    /**
     * 测试第一个tag的第二个单品
     */
    @Test
    public void testTag1Detail2(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(0).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(1);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag1Detail2_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag1Detail2_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag1Detail2_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag1Detail2_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag1Detail2_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag1Detail2_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
    }

    /**
     * 测试第一个tag的第三个单品
     */
    @Test
    public void testTag1Detail3(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(0).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(2);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag1Detail3_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag1Detail3_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag1Detail3_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag1Detail3_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag1Detail3_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag1Detail3_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    /**
     * 测试第一个tag的第四个单品
     */
    @Test
    public void testTag1Detail4(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(0).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(3);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag1Detail4_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag1Detail4_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag1Detail4_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag1Detail4_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag1Detail4_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag1Detail4_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    /**
     * 测试第一个tag的第五个单品
     */
    @Test
    public void testTag1Detail5(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(0).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(4);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag1Detail4_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag1Detail4_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag1Detail4_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag1Detail4_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag1Detail4_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag1Detail4_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }


    /**
     * 测试第二个tag的第一个单品
     */
    @Test
    public void testTag2Detail1(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(1).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg1Ele();
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg1Detail(u2);
        Matcher m = pattren.matcher(list.get(2));
        Matcher m1 = pattren.matcher(list.get(3));
        float subTitle = 0.0f;
        float price = 0.0f;
        if(m.find()){
            subTitle = Float.parseFloat(m.group());
        }
        if(m1.find()){
            price = Float.parseFloat(m1.group());
        }
        Assert.assertFalse(list.get(0).isEmpty());
        Assert.assertFalse(list.get(1).isEmpty());
        Assert.assertFalse(list.get(2).isEmpty());
        Assert.assertFalse(list.get(3).isEmpty());
        Assert.assertTrue(subTitle != 0.0);
        Assert.assertTrue(price != 0.0);
        u2.click();
        Log.i("UIAUTOMATOR", "testTag2Detail1_LIST " + list);
        if(list.get(0).indexOf("景点") != -1) {
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag2Detail1_TICKET " + t);
            Assert.assertEquals(list.get(0).split("\\|")[0], t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag2Detail1_TICKETnum " + n);
            Assert.assertTrue(n != 0);
        }
        if(list.get(0).indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag2Detail1_HOTLE " + t);
            Assert.assertEquals(list.get(0).split("\\|")[0], t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag2Detail1_HotelTnum " + n);
            Assert.assertTrue(n != 0);
        }
        if(list.get(0).indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
    }

    /**
     * 测试第二个tag的第二个单品
     */
    @Test
    public void testTag2Detail2(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(1).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(1);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag2Detail2_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag2Detail2_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag2Detail2_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag2Detail2_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag2Detail2_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag2Detail2_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
    }

    /**
     * 测试第二个tag的第三个单品
     */
    @Test
    public void testTag2Detail3(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(1).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(2);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag2Detail3_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag2Detail3_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag2Detail3_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag2Detail3_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag2Detail3_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag2Detail3_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    /**
     * 测试第二个tag的第四个单品
     */
    @Test
    public void testTag2Detail4(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(1).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(3);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag2Detail4_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag2Detail4_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag2Detail4_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag2Detail4_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag2Detail4_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag2Detail4_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    /**
     * 测试第二个tag的第五个单品
     */
    @Test
    public void testTag2Detail5(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(1).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(4);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag2Detail5_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag2Detail5_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag2Detail5_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag2Detail5_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag2Detail5_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag2Detail5_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    /**
     * 测试第三个tag的第一个单品
     */
    @Test
    public void testTag3Detail1(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(2).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg1Ele();
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg1Detail(u2);
        Matcher m = pattren.matcher(list.get(2));
        Matcher m1 = pattren.matcher(list.get(3));
        float subTitle = 0.0f;
        float price = 0.0f;
        if(m.find()){
            subTitle = Float.parseFloat(m.group());
        }
        if(m1.find()){
            price = Float.parseFloat(m1.group());
        }
        Assert.assertFalse(list.get(0).isEmpty());
        Assert.assertFalse(list.get(1).isEmpty());
        Assert.assertFalse(list.get(2).isEmpty());
        Assert.assertFalse(list.get(3).isEmpty());
        Assert.assertTrue(subTitle != 0.0);
        Assert.assertTrue(price != 0.0);
        u2.click();
        Log.i("UIAUTOMATOR", "testTag3Detail1_LIST " + list);
        if(list.get(0).indexOf("景点") != -1) {
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag3Detail1_TICKET " + t);
            Assert.assertEquals(list.get(0).split("\\|")[0], t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag3Detail1_TICKETnum " + n);
            Assert.assertTrue(n != 0);
        }
        if(list.get(0).indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag3Detail1_HOTLE " + t);
            Assert.assertEquals(list.get(0).split("\\|")[0], t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag3Detail1_HotelTnum " + n);
            Assert.assertTrue(n != 0);
        }
        if(list.get(0).indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
    }

    /**
     * 测试第三个tag的第二个单品
     */
    @Test
    public void testTag3Detail2(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(2).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(1);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag3Detail2_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag3Detail2_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag3Detail2_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag3Detail2_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag3Detail2_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag3Detail2_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
    }

    /**
     * 测试第三个tag的第三个单品
     */
    @Test
    public void testTag3Detail3(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(2).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(2);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag3Detail3_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag3Detail3_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag3Detail3_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag3Detail3_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag3Detail3_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag3Detail3_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    /**
     * 测试第三个tag的第四个单品
     */
    @Test
    public void testTag3Detail4(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(2).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(3);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag3Detail4_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag3Detail4_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag3Detail4_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag3Detail4_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag3Detail4_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag3Detail4_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    /**
     * 测试第三个tag的第五个单品
     */
    @Test
    public void testTag3Detail5(){
        UIHelper.getHomeElements().getGuessYouGo().getTagElement(2).click();
        UiObject2 u2 = UIHelper.getHomeElements().getGuessYouGo().getImg2Ele(4);
        List<String> list = UIHelper.getHomeElements().getGuessYouGo().getImg2Detail(u2);
        Log.i("UIAUTOMATOR", "testTag3Detail5_TAG1ING2 " + list);
        String titleZ = list.get(0);
        String title = titleZ.split("\\|")[0];
        String titleSub = titleZ.split("\\|")[1];
        float price = 0.0f;
        Assert.assertFalse(title.isEmpty());
        Assert.assertFalse(titleSub.isEmpty());
        if(list.get(1) != "xz"){
            Matcher m = pattren.matcher(list.get(1));
            if(m.find()){
                price = Float.parseFloat(m.group());
            }
            Log.i("UIAUTOMATOR", "testTag3Detail5_PRICE " + price);
            Assert.assertTrue(price != 0.0f);
        }
        u2.click();
        if(titleZ.indexOf("景点") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getTickedTitle();
            Log.i("UIAUTOMATOR", "testTag3Detail5_TICKETNAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getTicketsNum();
            Log.i("UIAUTOMATOR", "testTag3Detail5_TICKETNAME " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("酒店") != -1){
            String t = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleName();
            Log.i("UIAUTOMATOR", "testTag3Detail5_HOTLENAME " + t);
            Assert.assertEquals(title, t);
            int n = UIHelper.getAssertHome().getGuessYouGoAssert().getHotleNum();
            Log.i("UIAUTOMATOR", "testTag3Detail5_HOTLENUM " + n);
            Assert.assertTrue(n != 0);
        }
        if(titleZ.indexOf("度假") != -1){
            String s = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationSearch();
            Assert.assertEquals(s, "筛选");
            String s1 = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationZui();
            Assert.assertEquals(s1, "最近关注");
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getVacationNum();
            Assert.assertTrue(i != 0);
        }
        if(titleZ.indexOf("票价对比更省钱") != -1){
            int i = UIHelper.getAssertHome().getGuessYouGoAssert().getZhiNengZhongZhuan();
            Assert.assertTrue(i != 0);
        }
//        if(titleZ.indexOf(""))
    }

    @Test
    public void testSize(){
        UiObject2 p = UIHelper.getHomeElements().getGuessYouGo().getImgs();
        Point p_p = UIHelper.getElementsAction().getEleSize(p);
        Log.i("UIAUTOMATOR", "POINT " + p_p);
    }
}
